package com.basic.modules.ykf.controller;

import java.util.Arrays;

import cn.hutool.core.util.ObjectUtil;
import com.basic.common.annotation.StringTrim;
import com.basic.common.exception.RRException;
import com.basic.common.utils.ParamsModel;
import com.basic.common.validator.ValidatorUtils;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.basic.modules.ykf.entity.YkfNotCheckRecordEntity;
import com.basic.modules.ykf.service.YkfNotCheckRecordService;
import com.basic.common.utils.PageUtils;
import com.basic.common.utils.R;



/**
 * 子账号不检测记录
 *
 * @author maoheng
 * @email 15738859597@163.com
 * @date 2024-05-31 17:00:21
 */
@RestController
@RequestMapping("ykf/notCheckRecord")
public class YkfNotCheckRecordController {

    @Autowired
    private YkfNotCheckRecordService ykfNotCheckRecordService;

    /**
     * 列表-分页
     */
    @StringTrim
    @PostMapping("/page")
    public R list(@RequestBody ParamsModel<YkfNotCheckRecordEntity> params){
        PageUtils page = ykfNotCheckRecordService.queryPage(params);
        return R.ok(page);
    }


    /**
     * 信息
     */
    @PostMapping("/info")
    public R info(@RequestBody YkfNotCheckRecordEntity params){
        if (ObjectUtil.isEmpty(params) || ObjectUtil.isEmpty(params.getNotCheckRecordId())) {
            throw new RRException("参数缺失");
        }
        return R.ok(ykfNotCheckRecordService.getById(params.getNotCheckRecordId()));
    }

    /**
     * 保存
     */
    @PostMapping("/save")
    public R save(@RequestBody YkfNotCheckRecordEntity ykfNotCheckRecord){
        ValidatorUtils.validateEntity(ykfNotCheckRecord);
		ykfNotCheckRecordService.save(ykfNotCheckRecord);
        return R.ok();
    }

    /**
     * 修改
     */
    @PostMapping("/update")
    public R update(@RequestBody YkfNotCheckRecordEntity ykfNotCheckRecord){
        ValidatorUtils.validateEntity(ykfNotCheckRecord);
		ykfNotCheckRecordService.updateById(ykfNotCheckRecord);
        return R.ok();
    }

    /**
     * 删除
     */
    @PostMapping("/delete")
    public R delete(@RequestBody Long[] notCheckRecordIds){
		ykfNotCheckRecordService.removeByIds(Arrays.asList(notCheckRecordIds));
        return R.ok();
    }

}
